package com.sky.service.admin.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.mapper.admin.SetmealMapper;
import com.sky.pojo.Setmeal;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.admin.AdminSetmeaIService;
import com.sky.vo.SetmealVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SetmeaIServicelmpl implements AdminSetmeaIService {
    @Resource
    SetmealMapper setmealMapper;

    @Override
    public Result<PageResult> getPageSetmeal(Integer categoryId,String name,int page,int pageSize,Integer status) {
        PageHelper.startPage(page,pageSize);
        Page<SetmealVO> data = setmealMapper.getPage(categoryId,name,page,pageSize,status);

        PageResult pageSetmeal = PageResult.builder().records(data.getResult()).total(data.getTotal()).build();
        return Result.success(pageSetmeal);
    }
}
